﻿@model bonus.Models.User
@{ 
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@{
    ViewBag.Title = "首页";
}

@section Top
    {
    @Html.Partial("_Top")
}

<div class="container-fluid">
    
    <ol class="breadcrumb">
        <li class="breadcrumb-item">
            首页
        </li>
    </ol>
   
    @* 个人信息与公告栏目 *@
    <div class="row">
        <div class="col-lg-6">
            <div class="card mb-3">
                <div class="card-header">
                    <i class="fa fa-user"></i> 个人信息
                </div>
                <div class="card-body">
                    <div class="text-center mt-0 mb-4">
                        <h5>欢迎：<span>@Model.Name</span></h5>
                    </div>
                        <table class="table mb-0 table-bordered Pro-table text-center">
                            <tbody>
                                <tr>
                                    <td><strong>账号类型:</strong></td>
                                    <td>@bonus.Models.User.TypeClass.GetType(Model.UserType)</td>
                                </tr>
                                <tr>
                                    <td><strong>编号:</strong></td>
                                    <td>
                                        @Model.NO
                                    </td>
                                </tr>
                                <tr>
                                    <td><strong>余额:</strong></td>
                                    <td>@Model.Money</td>
                                </tr>
                                <tr>
                                    <td><strong>等级:</strong></td>
                                    <td>@bonus.Models.User.LevelClass.GetLevel(Model.Level)</td>
                                </tr>
                                <tr>
                                    <td><strong>注册时间:</strong></td>
                                    <td>@Model.AddDT.ToString("yyyy-MM-dd")</td>
                                </tr>
                            </tbody>
                        </table>
                </div>
            </div>
        </div>
        <div class="col-lg-6">
            <div class="card mb-3">
                <div class="card-header">
                    <i class="fa fa-comment"></i> 公告
                </div>
                <div class="list-group list-group-flush">
                    @{
                        if (ViewBag.Notice.Count < 1)
                        {
                            <h4 class="text-center pt-2 pb-2">暂无公告</h4>
                        }
                        else
                        {
                            foreach (var item in ViewBag.Notice)
                            {
                                <a class="list-group-item list-group-item-action" href="/Notice/index">
                                    <div class="media">
                                        <img class="d-flex mr-3 rounded-circle" src="http://placehold.it/45x45" alt="">
                                        <div class="media-body text-hidden">
                                            <strong>@item.Title</strong>
                                            <div class="dropdown-message small mb-2">@item.Content</div>
                                            <div class="text-muted smaller">添加时间:@item.AddDT.ToString("yyyy-MM-dd")</div>
                                        </div>
                                    </div>
                                </a>
                            }
                            <a class="list-group-item list-group-item-action text-center" href="/Notice/index">更多...</a>
                        }
                    }
                </div>
                
            </div>
        </div>
    </div>

    @if (Services.Cookie.GetUserType() == bonus.Models.Grade.AMDIN)
    {
        <div class="card mb-3" id="AreaChart">
            <div class="card-header">
                <i class="fa fa-area-chart"></i> <span>@DateTime.Now.AddMonths(-6).Year<span>年</span>@DateTime.Now.AddMonths(-6).Month<span>月</span> --- @DateTime.Now.AddMonths(-1).Year<span>年</span>@DateTime.Now.AddMonths(-1).Month<span>月报单折线图</span></span>
            </div>
            <div class="card-body">
                <canvas id="myAreaChart" width="100%" height="30"></canvas>
            </div>
            <div class="card-footer small text-muted">数据更新时间 @DateTime.Now.ToShortDateString()</div>
        </div>
        <div class="row">
            <div class="col-lg-8">
                <!-- Example Bar Chart Card-->
                <div class="card mb-3">
                    <div class="card-header">
                        <i class="fa fa-table"></i> 报单列表
                    </div>
                    <div class="card-body">
                        <div class="row">
                            <table class="table table-bordered text-center" id="dataTable" width="100%" cellspacing="0">
                                <thead>
                                    <tr>
                                        <th>报表月份</th>
                                        <th>类型</th>
                                        <th>金钱</th>
                                        <th>生成时间</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody></tbody>
                            </table>

                        </div>
                    </div>
                    <div class="card-footer small text-muted">数据更新时间 @DateTime.Now.ToShortDateString()</div>
                </div>
            </div>
            <div class="col-lg-4">
                <div class="card mb-3" id="PieChart">
                    <div class="card-header">
                        <i class="fa fa-pie-chart"></i> <span>财务报表</span>
                    </div>
                    <div class="card-body">
                        <canvas id="myPieChart" width="100%" height="100"></canvas>
                    </div>
                    <div class="card-footer small text-muted">数据更新时间 @DateTime.Now.ToShortDateString()</div>
                </div>
            </div>
        </div>
    }else
    {
        <div class="row">
            @*<div class="col-lg-6">
                <div class="card mb-3">
                    <div class="card-header">
                        <i class="fa fa-table"></i> <span>账号申请结果</span>
                    </div>
                    <div class="card-body p-0 mt-2 mb-2">
                        <table class="table table-bordered text-center" id="dataTableMsg" width="100%" cellspacing="0">
                            <thead>
                                <tr>
                                    <th>申请者编号</th>
                                    <th>申请者姓名</th>
                                    <th>管理员回复内容</th>
                                    <th>提交时间</th>
                                </tr>
                            </thead>
                            <tbody>
                                @{
                                    if (ViewBag.Message.Count < 1)
                                    {
                                        <tr><td><span class="text-center">暂无数据</span></td></tr>
                                    }
                                    else
                                    {
                                        foreach (var item in ViewBag.Message)
                                        {
                                            <tr>
                                                <td>@item.UserNo</td>
                                                <td>@item.Name</td>
                                                <td>@item.Content</td>
                                                <td>@item.AddDT</td>
                                            </tr>
                                        }
                                    }
                                }
                            </tbody>
                        </table>
                    </div>
                    <div class="card-footer small text-muted">数据更新时间 @DateTime.Now.ToShortDateString()</div>
                </div>
            </div>*@
            <div class="col-lg-12">
                <div class="card card-register mx-auto mb-3" id="PieChart">
                    <div class="card-header">
                        <i class="fa fa-pie-chart"></i> <span>财务报表</span>
                    </div>
                    <div class="card-body">
                        <canvas id="myPieChart" width="100%" height="100"></canvas>
                    </div>
                    <div class="card-footer small text-muted">数据更新时间 @DateTime.Now.ToShortDateString()</div>
                </div>
            </div>
        </div>
    }
</div>

<script src="~/Scripts/sb-admin-datatables.js"></script>
<script src="~/Scripts/sb-admin-charts.js"></script>
<script src="~/Scripts/sb-admin.js"></script>
<script src="~/Scripts/Index.js"></script>